<template>
  <div class="login-container">
    <div class="login-header">
      <div class="login-header-title">
        <div class="text-30px">
          星间节点故障测试系统
        </div>
      </div>
    </div>

    <!-- 粒子背景 -->
    <div class="particles-container">
      <div v-for="i in 50" :key="`particle-${i}`" class="particle"></div>
    </div>
    
    <!-- 科技网格 -->
    <div class="tech-grid">
      <div class="horizontal-plane"></div>
      <div class="vertical-planes">
        <div v-for="i in 8" :key="`plane-${i}`" class="plane"></div>
      </div>
    </div>
    
    <!-- 动态连接线 -->
    <div class="connection-lines">
      <div v-for="i in 10" :key="`node-${i}`" class="node"></div>
      <div v-for="i in 15" :key="`line-${i}`" class="line"></div>
      <div v-for="i in 10" :key="`flow-${i}`" class="data-flow"></div>
    </div>
    
    <!-- 全息投影元素 -->
    <div class="hologram-elements">
      <div class="ring"></div>
      <div class="ring"></div>
      <div class="hex-grid"></div>
      <div v-for="i in 8" :key="`text-${i}`" class="floating-text">{{ ['SYSTEM', 'SECURE', 'ACCESS', 'DATA', 'SYNCING', 'LOADING', 'READY', 'INIT'][i-1] }}</div>
    </div>
    
    <!-- 中央图案 -->
    <div class="center-design">
      <div class="center-circle"></div>
      <!-- <img src="/src/assets/imgs/login-bg1.png" class="center-logo" alt="仿真测试平台"> -->
      <div class="orbit">
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
      </div>
      <div class="orbit">
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
      </div>
      <div class="orbit">
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
        <div class="satellite"></div>
      </div>
    </div>
    
    <div class="login-box">
      <div class="login-panel animate__animated animate__fadeInDown">
        <div class="border-beam top"></div>
        <div class="border-beam right"></div>
        <div class="border-beam bottom"></div>
        <div class="border-beam left"></div>
        
        <!-- 添加角落装饰 -->
       
        
        <!-- 添加扫描线效果 -->
        <div class="panel-scanline"></div>
        
        <div class="panel-header">
          <h2 class="tech-title">{{currentPage==1?'登录':'注册账号'}}</h2>
        </div>
        
        <div v-if="currentPage==1" class="panel-body animate__animated animate__zoomIn">
          <div class="form-grid"></div>
          <el-form :model="loginFormData" :rules='loginFromRules' ref='loginFormRef'>
            <el-form-item prop='userAccount'>
              <el-input placeholder="用户名" v-model="loginFormData.userAccount">
                <template #prefix>
                  <svg-icon icon-class="userAccount" class="svg-icon"></svg-icon>
                </template>
              </el-input>
            </el-form-item>
            <el-form-item prop='userPassword'>
              <el-input placeholder="密码" v-model="loginFormData.userPassword" show-userPassword>
                <template #prefix>
                  <svg-icon icon-class="login-password" class="svg-icon"></svg-icon>
                </template>
              </el-input>
            </el-form-item>
          </el-form>
          
          <div class="account-options">
            <el-radio-group v-model="rememberAccount">
              <el-radio :label="'1'" size="large">记住账号</el-radio>
              <el-radio :label="'2'" size="large">清除账号</el-radio>
            </el-radio-group>
          </div>
          
          <div class="form-buttons">
            <div class="tech-button global_btn login-btn" style="width: 100%;" v-globalBtnLoading="{handler:onSubmit,text:'登录中...'}">
              <span>登录</span>
              <div class="button-glow"></div>
            </div>
            <div class="tech-button  register-btn"  @click="onRegister">
              <span>注册</span>
              <div class="button-glow"></div>
            </div>
          </div>
          
          <!-- 环境切换开关 -->
          <div class="env-switch">
            <div class="switch-label">API环境:</div>
            <div class="switch-container" @click="toggleEnvironment">
              <div class="switch-track" :class="{ 'active': apiEnv === 'java' }">
                <div class="switch-thumb" :class="{ 'active': apiEnv === 'java' }"></div>
              </div>
              <div class="switch-text">{{ apiEnv === 'local' ? '本地环境' : 'Java环境' }}</div>
            </div>
          </div>
        </div>
        
        <div v-else-if="currentPage==2" class="panel-body animate__animated animate__zoomIn">
          <div class="form-grid"></div>
          <el-form :model="registerForm" :rules="registerFormRules" ref="registerRef">
            <el-form-item prop='userAccount'>
              <el-input placeholder="用户名" v-model="registerForm.userAccount">
                <template #prefix>
                  <svg-icon icon-class="userAccount" class="svg-icon"></svg-icon>
                </template>
              </el-input>
            </el-form-item>
            <el-form-item prop="userPassword">
              <el-input prefix-icon="Lock" placeholder="密码" v-model="registerForm.userPassword" show-userPassword></el-input>
            </el-form-item>
            <el-form-item prop="provingPassWord">
              <el-input prefix-icon="Lock" placeholder="确认密码" v-model="registerForm.provingPassWord" show-userPassword></el-input>
            </el-form-item>
          </el-form>
          
          <div class="form-buttons">
            <div class="tech-button global_btn login-btn" style="width: 100%;" v-globalBtnLoading="{handler:handleRegister,text:'注册中...'}">
              <span>注册</span>
              <div class="button-glow"></div>
            </div>
            <div class="tech-button cancel-btn" @click="handleGoLogin">
              <span>返回</span>
              <div class="button-glow"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: 'Login'
}
</script>

<script setup lang="ts">
import{ useUserInfoStore} from '@/stores/userInfo'
import { useRouter } from 'vue-router'
import { ElMessage } from "element-plus";
import cloneDeep from 'lodash/cloneDeep'
import * as encry from "@/utils/cryptoUtils";
import {userApi} from '@/api/user.ts'
import {ElNotificationFn} from '@/utils/computedUtils'
const router = useRouter()
const useUserInfo = useUserInfoStore()
const currentPage:any = ref(1)
const loginFormData:any = ref({
  userAccount:'admin',
  userPassword:'admin123'
})
const loginFromRules:any = {
  userAccount: {
      required: true,
      message: "输入账号",
      trigger: "blur",
    },
    userPassword:{
      required: true,
      message: "输入密码",
      trigger: "blur",
    }
}
const loginFormRef:any = ref(null)
const onSubmit = async () => {
  await loginFormRef.value.validate();    
  try {
  await  useUserInfo.login({
    username:loginFormData.value.userAccount,
    password:loginFormData.value.userPassword
  })
  router.push({
    path:'/'
  })
  } catch (error) {
    console.log(error,"error");
  }
};
const onRegister = ()=>{
  currentPage.value = 2
}
const rememberAccount:any = ref('0')
const getAccount = () =>{
  let rememberedUser:any = localStorage.getItem("rememberedUser");
  if(rememberedUser){
    rememberedUser = JSON.parse(encry.decrypt(rememberedUser)) 
    loginFormData.value.userAccount = rememberedUser.userAccount
    loginFormData.value.userPassword = rememberedUser.userPassword
    rememberAccount.value ="1"
  }
}
getAccount()
watch(()=>rememberAccount.value,(now:any)=>{
  if(now=="1"){
  localStorage.setItem("rememberedUser",encry.encrypt({
    userAccount:loginFormData.value.userAccount,
    userPassword:loginFormData.value.userPassword
    }))
  }else{
    localStorage.removeItem("rememberedUser")
  }
})
const registerRef:any = ref()
const registerForm:any = ref({
  userAccount:"admin222",
  userPassword:"88888888",
  provingPassWord:"88888888",
})
const checkPassWord = (rule: any, value: any, callback: any)=>{
    if(!value){
      callback(new Error('请再次输入密码'))
      return
    }
    if (value.length < 8 || value.length > 16) {
    callback(new Error('长度在 8 到 16 个字符'));
    return;
     }

    if(value !== registerForm.value.userPassword){
      callback(new Error('两次密码不一致'))
      return
    }
    callback()
}
const  registerFormRules:any = {
  userAccount: [
    {
      require:true,
      trigger: "blur",
      message:'请输入用户名'
    },
  ],
  userPassword:[
    { required: true, message: "请输入密码", trigger: "blur" },
    { min: 8, max: 16, message: "长度在 8 到 16 个字符", trigger: "blur" },
  ],
  provingPassWord:[
    { validator: checkPassWord, trigger: "blur" },
  ],
}
const handleGoLogin = ()=>{
  registerRef.value.resetFields()
  currentPage.value = 1
}

const handleRegister = () =>{
  registerRef.value.validate(async (valid:any) => {
    if (valid) {
      try {
        const data = {...registerForm.value,userName:registerForm.value.userAccount}
        delete data.provingPassWord
        await userApi.register({
          loginName:registerForm.value.userAccount,
          userName:registerForm.value.userAccount,
          passWord:registerForm.value.userPassword
        })
        ElMessage.success("注册成功")
        for(let key in loginFormData.value){
          loginFormData.value[key] = registerForm.value[key] 
        }
        currentPage.value = 1
      } catch (error) {
        console.log(error,"error");   
      }
    }else{
      console.log("error");
    }
  })
}
const apiEnv = ref('local')
const toggleEnvironment = () => {
  apiEnv.value = apiEnv.value === 'local' ? 'java' : 'local'
  localStorage.setItem('apiEnvironment', apiEnv.value)
  ElNotificationFn('success',`已切换至${apiEnv.value === 'local' ? '本地环境' : 'Java环境'}`)
   if(apiEnv.value === 'local'){
    loginFormData.value.userAccount = 'admin'
    loginFormData.value.userPassword = 'admin123'
   }else{
    loginFormData.value.userAccount = 'admin222'
    loginFormData.value.userPassword = '88888888'
   }
}
onMounted(()=>{
  if(localStorage.getItem('apiEnvironment') === 'local'){
    apiEnv.value = 'local'
  }else{
    apiEnv.value = 'java'
  }
})
</script>

<style lang="scss" scoped>
.login-container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #162c42 0%, #1e3750 50%, #1a2c3f 100%);
  
  .login-header{
    width: 100%;
    position: fixed;
    background-image: url('@/assets/imgs/login-header.png');
    background-size: 100% 100%;
    height:140px;
    top: 0;
    left: 0;
    filter: brightness(1.1); /* 增加亮度 */
    z-index: 2; /* 确保层级高于背景 */
    
    .login-header-title{
      font-size: 37px;
      color: #fff;
      display: flex;
      height: 32px;
      position: absolute;
      top: 20%;
      left: 50%;
      transform: translate(-50%);
      font-family: YouSheBiaoTiHei;
      text-shadow: 0 0 15px rgba(0, 180, 255, 0.7);
      letter-spacing: 2px;
    }
  }

  /* 背景图片优化 */
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('@/assets/imgs/login-bg2.png');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.85;
    z-index: 0;
    filter: brightness(0.9) contrast(1.1);
  }
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
 /*    background: 
      linear-gradient(180deg, rgba(13, 25, 42, 0.7) 0%, rgba(15, 28, 45, 0.3) 30%),
      radial-gradient(circle at 20% 35%, rgba(0, 180, 255, 0.3) 0%, transparent 50%),
      radial-gradient(circle at 75% 60%, rgba(0, 120, 215, 0.25) 0%, transparent 50%),
      radial-gradient(circle at 40% 80%, rgba(0, 150, 235, 0.2) 0%, transparent 40%); */
    z-index: 1;
    pointer-events: none;
  }
}

/* 粒子背景 */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  
  .particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: rgba(0, 180, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 180, 255, 0.8);
    pointer-events: none;
    z-index: 1;
    
    @for $i from 1 through 50 {
      $top: 2% * $i;
      $left: 2% * $i;
      $delay: 0.1s * $i;
      $duration: 20s + $i * 0.5;
      $size: 0.5 + ($i % 5) * 0.1;
      
      &:nth-child(#{$i}) {
        top: $top;
        left: $left;
        opacity: 0.3 + ($i % 7) * 0.1;
        animation: particle-float $duration infinite linear;
        animation-delay: $delay;
        transform: scale($size);
      }
    }
  }
}

/* 科技网格 */
.tech-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  perspective: 1000px;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
      linear-gradient(90deg, rgba(0, 180, 255, 0.03) 1px, transparent 1px),
      linear-gradient(rgba(0, 180, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    transform: rotateX(60deg) scale(3);
    transform-origin: center;
    animation: grid-move 20s linear infinite;
  }
  
  .horizontal-plane {
    position: absolute;
    left: -100%;
    bottom: -20%;
    width: 300%;
    height: 40%;
    background: linear-gradient(90deg, 
      rgba(0, 180, 255, 0) 0%,
      rgba(0, 180, 255, 0.03) 20%,
      rgba(0, 180, 255, 0.03) 80%,
      rgba(0, 180, 255, 0) 100%
    );
    transform: rotateX(80deg);
    transform-origin: center;
    animation: plane-pulse 4s infinite alternate;
  }
  
  .vertical-planes {
    position: absolute;
    width: 100%;
    height: 100%;
    
    .plane {
      position: absolute;
      top: 0;
      width: 1px;
      height: 100%;
      background: linear-gradient(to bottom,
        rgba(0, 180, 255, 0),
        rgba(0, 180, 255, 0.1),
        rgba(0, 180, 255, 0.2),
        rgba(0, 180, 255, 0.1),
        rgba(0, 180, 255, 0)
      );
      box-shadow: 0 0 15px rgba(0, 180, 255, 0.1);
      
      &:nth-child(1) { left: 12.5%; animation: plane-glow 8s infinite; animation-delay: 0.5s; height: 80%; top: 5%; }
      &:nth-child(2) { left: 25%; animation: plane-glow 8s infinite; animation-delay: 1s; height: 65%; top: 10%; }
      &:nth-child(3) { left: 37.5%; animation: plane-glow 8s infinite; animation-delay: 1.5s; height: 90%; top: 5%; }
      &:nth-child(4) { left: 50%; animation: plane-glow 8s infinite; animation-delay: 2s; height: 70%; top: 15%; }
      &:nth-child(5) { left: 62.5%; animation: plane-glow 8s infinite; animation-delay: 2.5s; height: 85%; top: 8%; }
      &:nth-child(6) { left: 75%; animation: plane-glow 8s infinite; animation-delay: 3s; height: 60%; top: 12%; }
      &:nth-child(7) { left: 87.5%; animation: plane-glow 8s infinite; animation-delay: 3.5s; height: 75%; top: 18%; }
      &:nth-child(8) { left: 100%; animation: plane-glow 8s infinite; animation-delay: 4s; height: 95%; top: 2%; }
    }
  }
}

/* 动态连接线 */
.connection-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
  
  .node {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(0, 180, 255, 0.7);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.5);
    
    &:nth-child(1) { top: 15%; left: 10%; animation: node-pulse 4s infinite alternate; animation-delay: 0.3s; }
    &:nth-child(2) { top: 25%; left: 35%; animation: node-pulse 4s infinite alternate; animation-delay: 0.6s; }
    &:nth-child(3) { top: 45%; left: 15%; animation: node-pulse 4s infinite alternate; animation-delay: 0.9s; }
    &:nth-child(4) { top: 65%; left: 28%; animation: node-pulse 4s infinite alternate; animation-delay: 1.2s; }
    &:nth-child(5) { top: 85%; left: 45%; animation: node-pulse 4s infinite alternate; animation-delay: 1.5s; }
    &:nth-child(6) { top: 35%; left: 55%; animation: node-pulse 4s infinite alternate; animation-delay: 1.8s; }
    &:nth-child(7) { top: 75%; left: 5%; animation: node-pulse 4s infinite alternate; animation-delay: 2.1s; }
    &:nth-child(8) { top: 55%; left: 22%; animation: node-pulse 4s infinite alternate; animation-delay: 2.4s; }
    &:nth-child(9) { top: 18%; left: 48%; animation: node-pulse 4s infinite alternate; animation-delay: 2.7s; }
    &:nth-child(10) { top: 90%; left: 18%; animation: node-pulse 4s infinite alternate; animation-delay: 3s; }
  }
  
  .line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg,
      rgba(0, 180, 255, 0.1),
      rgba(0, 180, 255, 0.5),
      rgba(0, 180, 255, 0.1)
    );
    z-index: 1;
    transform-origin: left center;
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.3);
    
    &:nth-child(11) { top: 12%; left: 5%; width: 10%; transform: rotate(15deg); animation: line-pulse 6s infinite alternate; animation-delay: 0.4s; }
    &:nth-child(12) { top: 28%; left: 22%; width: 15%; transform: rotate(-20deg); animation: line-pulse 6s infinite alternate; animation-delay: 0.8s; }
    &:nth-child(13) { top: 45%; left: 8%; width: 18%; transform: rotate(5deg); animation: line-pulse 6s infinite alternate; animation-delay: 1.2s; }
    &:nth-child(14) { top: 60%; left: 35%; width: 12%; transform: rotate(-10deg); animation: line-pulse 6s infinite alternate; animation-delay: 1.6s; }
    &:nth-child(15) { top: 75%; left: 15%; width: 20%; transform: rotate(25deg); animation: line-pulse 6s infinite alternate; animation-delay: 2s; }
    &:nth-child(16) { top: 32%; left: 40%; width: 8%; transform: rotate(-15deg); animation: line-pulse 6s infinite alternate; animation-delay: 2.4s; }
    &:nth-child(17) { top: 55%; left: 5%; width: 15%; transform: rotate(10deg); animation: line-pulse 6s infinite alternate; animation-delay: 2.8s; }
    &:nth-child(18) { top: 85%; left: 28%; width: 18%; transform: rotate(-25deg); animation: line-pulse 6s infinite alternate; animation-delay: 3.2s; }
    &:nth-child(19) { top: 18%; left: 32%; width: 10%; transform: rotate(20deg); animation: line-pulse 6s infinite alternate; animation-delay: 3.6s; }
    &:nth-child(20) { top: 42%; left: 25%; width: 12%; transform: rotate(-5deg); animation: line-pulse 6s infinite alternate; animation-delay: 4s; }
    &:nth-child(21) { top: 65%; left: 18%; width: 15%; transform: rotate(15deg); animation: line-pulse 6s infinite alternate; animation-delay: 4.4s; }
    &:nth-child(22) { top: 25%; left: 10%; width: 8%; transform: rotate(-8deg); animation: line-pulse 6s infinite alternate; animation-delay: 4.8s; }
    &:nth-child(23) { top: 80%; left: 12%; width: 20%; transform: rotate(12deg); animation: line-pulse 6s infinite alternate; animation-delay: 5.2s; }
    &:nth-child(24) { top: 38%; left: 35%; width: 10%; transform: rotate(-18deg); animation: line-pulse 6s infinite alternate; animation-delay: 5.6s; }
    &:nth-child(25) { top: 50%; left: 22%; width: 15%; transform: rotate(8deg); animation: line-pulse 6s infinite alternate; animation-delay: 6s; }
  }
  
  .data-flow {
    position: absolute;
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg,
      rgba(0, 180, 255, 0),
      rgba(0, 180, 255, 0.8),
      rgba(0, 180, 255, 0)
    );
    filter: blur(1px);
    
    &:nth-child(26) { top: 15%; left: -20px; animation: data-flow 7s linear infinite; animation-delay: 0.7s; }
    &:nth-child(27) { top: 28%; left: -20px; animation: data-flow 9s linear infinite; animation-delay: 1.4s; }
    &:nth-child(28) { top: 42%; left: -20px; animation: data-flow 6s linear infinite; animation-delay: 2.1s; }
    &:nth-child(29) { top: 55%; left: -20px; animation: data-flow 8s linear infinite; animation-delay: 2.8s; }
    &:nth-child(30) { top: 68%; left: -20px; animation: data-flow 5s linear infinite; animation-delay: 3.5s; }
    &:nth-child(31) { top: 80%; left: -20px; animation: data-flow 7s linear infinite; animation-delay: 4.2s; }
    &:nth-child(32) { top: 22%; left: -20px; animation: data-flow 10s linear infinite; animation-delay: 4.9s; }
    &:nth-child(33) { top: 35%; left: -20px; animation: data-flow 6s linear infinite; animation-delay: 5.6s; }
    &:nth-child(34) { top: 75%; left: -20px; animation: data-flow 8s linear infinite; animation-delay: 6.3s; }
    &:nth-child(35) { top: 90%; left: -20px; animation: data-flow 7s linear infinite; animation-delay: 7s; }
  }
}

/* 全息投影元素 */
.hologram-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  
  .ring {
    position: absolute;
    border: 1px solid rgba(0, 180, 255, 0.3);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.1);
    
    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border: 1px dashed rgba(0, 180, 255, 0.2);
      border-radius: 50%;
      animation: rotate 20s linear infinite;
    }
    
    &:nth-child(1) {
      width: 300px;
      height: 300px;
      top: 50%;
      left: 20%;
      transform: translate(-50%, -50%);
      animation: float 15s ease-in-out infinite;
    }
    
    &:nth-child(2) {
      width: 200px;
      height: 200px;
      top: 30%;
      left: 35%;
      transform: translate(-50%, -50%);
      animation: float 12s ease-in-out infinite reverse;
      animation-delay: 2s;
    }
  }
  
  .hex-grid {
    position: absolute;
    top: 60%;
    left: 25%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M0,10 L5,17.5 L15,17.5 L20,10 L15,2.5 L5,2.5 Z' fill='none' stroke='rgba(0,180,255,0.15)' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 30px 30px;
    opacity: 0.5;
    animation: hex-rotate 30s linear infinite;
  }
  
  .floating-text {
    position: absolute;
    font-family: monospace;
    color: rgba(0, 180, 255, 0.4);
    font-size: 12px;
    white-space: nowrap;
    user-select: none;
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.4);
    
    &:nth-child(4) { top: 25%; left: 12%; opacity: 0.5; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 0.3s; }
    &:nth-child(5) { top: 42%; left: 8%; opacity: 0.3; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 0.6s; }
    &:nth-child(6) { top: 65%; left: 15%; opacity: 0.6; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 0.9s; }
    &:nth-child(7) { top: 18%; left: 30%; opacity: 0.4; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 1.2s; }
    &:nth-child(8) { top: 38%; left: 22%; opacity: 0.7; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 1.5s; }
    &:nth-child(9) { top: 75%; left: 35%; opacity: 0.3; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 1.8s; }
    &:nth-child(10) { top: 52%; left: 15%; opacity: 0.5; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 2.1s; }
    &:nth-child(11) { top: 85%; left: 28%; opacity: 0.6; transform: translateY(0); animation: float-text 15s infinite alternate; animation-delay: 2.4s; }
  }
}

/* 中央图案 */
.center-design {
  position: absolute;
  top: 50%;
  left: 30%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  z-index: 4;
  pointer-events: none;
  opacity: 0.7;
  
  .center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 1px solid rgba(0, 180, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(0, 180, 255, 0.3);
    animation: pulse 4s infinite alternate;
  }
  
  .center-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(0, 180, 255, 0.8));
    z-index: 5;
    animation: logo-pulse 3s infinite alternate ease-in-out;
  }
  
  .orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px dashed rgba(0, 180, 255, 0.3);
    border-radius: 50%;
    
    &:nth-child(3) {
      width: 150px;
      height: 150px;
      animation: rotate 20s linear infinite;
    }
    
    &:nth-child(4) {
      width: 200px;
      height: 200px;
      animation: rotate 30s linear infinite reverse;
    }
    
    &:nth-child(5) {
      width: 250px;
      height: 250px;
      animation: rotate 40s linear infinite;
    }
    
    .satellite {
      position: absolute;
      width: 8px;
      height: 8px;
      background-color: rgba(0, 180, 255, 0.7);
      border-radius: 50%;
      box-shadow: 0 0 10px rgba(0, 180, 255, 0.6);
      
      &:nth-child(1) {
        top: 0;
        left: 50%;
        transform: translateX(-50%);
      }
      
      &:nth-child(2) {
        top: 50%;
        right: 0;
        transform: translateY(-50%);
      }
      
      &:nth-child(3) {
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
      }
      
      &:nth-child(4) {
        top: 50%;
        left: 0;
        transform: translateY(-50%);
      }
    }
  }
}

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 450px;
  margin-right: 3%;
  margin-top: 6%;
}

.login-panel {
  width: 100%;
 /*  background: linear-gradient(
    180deg, 
    rgba(15, 35, 60, 0.75) 0%, 
    rgba(18, 40, 70, 0.8) 50%, 
    rgba(12, 30, 55, 0.75) 100%
  ); */
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 180, 255, 0.4);
  box-shadow: 
    inset 0 0 40px rgba(0, 140, 255, 0.1),
    0 0 30px rgba(0, 120, 255, 0.2),
    0 0 10px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  padding: 40px 25px;
  animation: panel-pulse 6s infinite alternate ease-in-out;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
      transparent, 
      rgba(0, 180, 255, 0.9), 
      transparent
    );
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.8);
    animation: scanline 8s infinite;
  }
  
  &::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
      circle at 50% 0%,
      rgba(0, 180, 255, 0.15),
      transparent 70%
    );
    pointer-events: none;
    z-index: 3;
  }
}

.corner-decoration {
  position: absolute;
  width: 15px;
  height: 15px;
  z-index: 5;
  
  &.top-left {
    top: 0;
    left: 0;
    border-top: 2px solid rgba(0, 180, 255, 0.8);
    border-left: 2px solid rgba(0, 180, 255, 0.8);
    animation: corner-pulse 3s infinite alternate;
  }
  
  &.top-right {
    top: 0;
    right: 0;
    border-top: 2px solid rgba(0, 180, 255, 0.8);
    border-right: 2px solid rgba(0, 180, 255, 0.8);
    animation: corner-pulse 3s infinite alternate;
    animation-delay: 0.5s;
  }
  
  &.bottom-right {
    bottom: 0;
    right: 0;
    border-bottom: 2px solid rgba(0, 180, 255, 0.8);
    border-right: 2px solid rgba(0, 180, 255, 0.8);
    animation: corner-pulse 3s infinite alternate;
    animation-delay: 1s;
  }
  
  &.bottom-left {
    bottom: 0;
    left: 0;
    border-bottom: 2px solid rgba(0, 180, 255, 0.8);
    border-left: 2px solid rgba(0, 180, 255, 0.8);
    animation: corner-pulse 3s infinite alternate;
    animation-delay: 1.5s;
  }
}

.border-beam {
  position: absolute;
  opacity: 0.6;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 220, 255, 0.9),
    transparent
  );
  filter: blur(1px);
  animation: border-beam 4s linear infinite;
  
  &.top {
    top: 0;
    left: 0;
    height: 2px;
    width: 100px;
  }
  
  &.right {
    top: 0;
    right: 0;
    height: 100px;
    width: 2px;
    animation-delay: 1s;
    background: linear-gradient(
      180deg,
      transparent,
      rgba(0, 220, 255, 0.9),
      transparent
    );
  }
  
  &.bottom {
    bottom: 0;
    right: 0;
    height: 2px;
    width: 100px;
    animation-delay: 2s;
  }
  
  &.left {
    bottom: 0;
    left: 0;
    height: 100px;
    width: 2px;
    animation-delay: 3s;
    background: linear-gradient(
      180deg,
      transparent,
      rgba(0, 220, 255, 0.9),
      transparent
    );
  }
}

.panel-header {
  margin-bottom: 30px;
  text-align: center;
  position: relative;
  
  &::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(0, 200, 255, 0.9),
      transparent
    );
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.8);
  }
}

.tech-title {
  font-size: 26px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 2px;
  text-shadow: 0 0 15px rgba(0, 180, 255, 0.7);
  margin: 0;
  animation: text-glow 3s infinite alternate;
}

.panel-body {
  position: relative;
  z-index: 2;
  
  .form-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
      linear-gradient(rgba(0, 180, 255, 0.06) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0, 180, 255, 0.06) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
  }
  
  .el-form {
    margin-bottom: 20px;
    
    .el-form-item {
      margin-bottom: 20px;
      
      :deep(.el-input__wrapper) {
        background: rgba(15, 35, 65, 0.5);
        border: 1px solid rgba(0, 180, 255, 0.6);
        box-shadow: none;
        border-radius: 6px;
        transition: all 0.3s;
        
        &:hover, &:focus-within {
          border-color: rgba(0, 220, 255, 0.9);
          box-shadow: 0 0 12px rgba(0, 200, 255, 0.5);
        }
      }
      
      :deep(.el-input__inner) {
        color: rgba(255, 255, 255, 0.95);
        height: 42px;
        font-size: 15px;
        
        &::placeholder {
          color: rgba(255, 255, 255, 0.6);
        }
      }
      
      .svg-icon {
        color: rgba(0, 200, 255, 0.9);
        font-size: 18px;
      }
    }
  }
}

.account-options {
  margin-bottom: 25px;
  
  :deep(.el-radio__label) {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
  }
  
  :deep(.el-radio__inner) {
    background-color: rgba(15, 35, 65, 0.5);
    border-color: rgba(0, 180, 255, 0.6);
    
    &::after {
      background-color: rgba(0, 220, 255, 0.9);
    }
  }
  
  :deep(.el-radio__input.is-checked .el-radio__inner) {
    border-color: rgba(0, 200, 255, 0.9);
    background-color: rgba(0, 180, 255, 0.1);
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.4);
  }
  
  :deep(.el-radio__input.is-checked+.el-radio__label) {
    color: rgba(0, 200, 255, 0.95);
    text-shadow: 0 0 8px rgba(0, 180, 255, 0.4);
  }
}

.form-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tech-button {
  position: relative;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    90deg,
    rgba(0, 70, 140, 0.7) 0%,
    rgba(0, 120, 210, 0.8) 50%,
    rgba(0, 70, 140, 0.7) 100%
  );
  border: 1px solid rgba(0, 200, 255, 0.6);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s;
  text-shadow: 0 0 8px rgba(0, 200, 255, 0.6);
  
  &:hover {
    background: linear-gradient(
      90deg,
      rgba(0, 90, 180, 0.7) 0%,
      rgba(0, 140, 230, 0.8) 50%,
      rgba(0, 90, 180, 0.7) 100%
    );
    border-color: rgba(0, 220, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.4);
  }
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(0, 220, 255, 0.7),
      transparent
    );
    animation: flow-light 3s infinite ease-in-out;
  }
  
  .button-glow {
    position: absolute;
    top: 0;
    left: -100px;
    width: 80px;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.25),
      transparent
    );
    transform: skewX(-15deg);
    animation: button-glow 3s infinite;
  }
}

.login-btn {
  background: linear-gradient(
    90deg,
    rgba(0, 100, 180, 0.7) 0%,
    rgba(0, 150, 230, 0.8) 50%,
    rgba(0, 100, 180, 0.7) 100%
  );
}

.register-btn, .cancel-btn {
  background: linear-gradient(
    90deg,
    rgba(35, 50, 70, 0.7) 0%,
    rgba(50, 70, 100, 0.8) 50%,
    rgba(35, 50, 70, 0.7) 100%
  );
  border-color: rgba(0, 180, 255, 0.4);
}

@keyframes scanline {
  0%, 20%, 80%, 100% {
    transform: translateY(-100px);
    opacity: 0;
  }
  30%, 70% {
    opacity: 1;
  }
  50% {
    transform: translateY(300px);
  }
}

@keyframes border-flow {
  0% {
    border-image-source: linear-gradient(
      to right,
      rgba(0, 180, 255, 0) 0%,
      rgba(0, 180, 255, 0.5) 25%, 
      rgba(0, 180, 255, 0.8) 50%, 
      rgba(0, 180, 255, 0.5) 75%,
      rgba(0, 180, 255, 0) 100%
    );
  }
  50% {
    border-image-source: linear-gradient(
      to right,
      rgba(0, 180, 255, 0.5) 0%,
      rgba(0, 180, 255, 0.8) 25%, 
      rgba(0, 180, 255, 0.5) 50%, 
      rgba(0, 180, 255, 0) 75%,
      rgba(0, 180, 255, 0.5) 100%
    );
  }
  100% {
    border-image-source: linear-gradient(
      to right,
      rgba(0, 180, 255, 0) 0%,
      rgba(0, 180, 255, 0.5) 25%, 
      rgba(0, 180, 255, 0.8) 50%, 
      rgba(0, 180, 255, 0.5) 75%,
      rgba(0, 180, 255, 0) 100%
    );
  }
}

@keyframes corner-pulse {
  0% {
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.4);
    opacity: 0.7;
  }
  100% {
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.7);
    opacity: 1;
  }
}

@keyframes border-beam {
  0% {
    left: -60px;
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    left: calc(100% + 60px);
    opacity: 0;
  }
}

@keyframes panel-pulse {
  0% {
    box-shadow: 
      inset 0 0 40px rgba(0, 140, 255, 0.1),
      0 0 30px rgba(0, 120, 255, 0.15),
      0 0 10px rgba(0, 0, 0, 0.5);
  }
  100% {
    box-shadow: 
      inset 0 0 50px rgba(0, 140, 255, 0.15),
      0 0 40px rgba(0, 120, 255, 0.25),
      0 0 10px rgba(0, 0, 0, 0.5);
  }
}

@keyframes logo-pulse {
  0% {
    filter: drop-shadow(0 0 15px rgba(0, 180, 255, 0.6));
  }
  100% {
    filter: drop-shadow(0 0 25px rgba(0, 180, 255, 0.8));
  }
}

@keyframes text-glow {
  0% {
    text-shadow: 0 0 10px rgba(0, 180, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
  }
  100% {
    text-shadow: 0 0 20px rgba(0, 180, 255, 0.8);
    color: #FFFFFF;
  }
}

@keyframes flow-light {
  0% {
    opacity: 0.5;
    background-position: -100% 0;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.5;
    background-position: 200% 0;
  }
}

@keyframes button-glow {
  0% {
    left: -100px;
  }
  100% {
    left: 200%;
  }
}

@keyframes h-line-move {
  0% {
    width: 0;
    left: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    width: 100%;
    left: 0;
    opacity: 0;
  }
}

@keyframes v-line-move {
  0% {
    height: 0;
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    height: 100%;
    top: 0;
    opacity: 0;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

@keyframes rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.3), 0 0 10px rgba(0, 180, 255, 0.1) inset;
  }
  100% {
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.5), 0 0 20px rgba(0, 180, 255, 0.2) inset;
  }
}

@keyframes logo-glow {
  0% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

@keyframes grid-move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 30px 30px;
  }
}

@keyframes particle-float {
  0% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-30px) translateX(10px);
  }
  50% {
    transform: translateY(0) translateX(20px);
  }
  75% {
    transform: translateY(30px) translateX(10px);
  }
  100% {
    transform: translateY(0) translateX(0);
  }
}

@keyframes plane-pulse {
  0% {
    opacity: 0.3;
  }
  100% {
    opacity: 0.6;
  }
}

@keyframes plane-glow {
  0%, 100% {
    opacity: 0.1;
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.1);
  }
  50% {
    opacity: 0.3;
    box-shadow: 0 0 20px rgba(0, 180, 255, 0.3);
  }
}

@keyframes node-pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes line-pulse {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes data-flow {
  0% {
    left: -20px;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

@keyframes float-text {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes hex-rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* 环境切换开关样式 */
.env-switch {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(15, 35, 65, 0.4);
  border-radius: 8px;
  border: 1px solid rgba(0, 180, 255, 0.4);
  box-shadow: 0 0 10px rgba(0, 120, 255, 0.15) inset;
  
  .switch-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-right: 10px;
    text-shadow: 0 0 8px rgba(0, 150, 255, 0.3);
  }
  
  .switch-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    
    .switch-track {
      width: 42px;
      height: 22px;
      background: rgba(20, 45, 80, 0.6);
      border-radius: 12px;
      padding: 2px;
      position: relative;
      transition: all 0.3s ease;
      border: 1px solid rgba(0, 180, 255, 0.5);
      box-shadow: 0 0 8px rgba(0, 120, 255, 0.2) inset;
      
      &.active {
        background: rgba(0, 140, 220, 0.3);
        border-color: rgba(0, 200, 255, 0.7);
        box-shadow: 0 0 12px rgba(0, 180, 255, 0.4) inset;
      }
    }
    
    .switch-thumb {
      width: 18px;
      height: 18px;
      background: rgba(120, 200, 255, 0.9);
      border-radius: 50%;
      position: absolute;
      left: 2px;
      transition: all 0.3s ease;
      box-shadow: 0 0 12px rgba(0, 180, 255, 0.6);
      
      &::before {
        content: '';
        position: absolute;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: rgba(220, 250, 255, 0.95);
        top: 5.5px;
        left: 5.5px;
      }
      
      &.active {
        left: 22px;
        background: rgba(0, 220, 255, 0.95);
        box-shadow: 0 0 15px rgba(0, 200, 255, 0.8);
      }
    }
    
    .switch-text {
      font-size: 14px;
      margin-left: 12px;
      color: rgba(0, 200, 255, 0.95);
      font-weight: 500;
      text-shadow: 0 0 8px rgba(0, 180, 255, 0.5);
      min-width: 70px;
    }
  }
}

.panel-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(0, 220, 255, 0.5) 20%, 
    rgba(0, 220, 255, 0.8) 50%, 
    rgba(0, 220, 255, 0.5) 80%, 
    transparent 100%
  );
  box-shadow: 0 0 10px rgba(0, 180, 255, 0.7);
  opacity: 0.8;
  z-index: 20;
  animation: panel-scanline 4s linear infinite;
}

@keyframes panel-scanline {
  0% {
    top: -5px;
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}
</style>
